/**
 * 2017，thor.com，all rights reserved。
 * 
 * Project：		palmmall-api
 * Filename：	ReportParam.java
 * Created：		2017年4月27日
 * Creator：		wolv
 */
package com.thor.palmmall.api.rpt;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.thor.commons.exception.ThorServiceException;
import com.thor.commons.util.Assert;
import com.thor.commons.util.StringUtil;

/**
 * @author wolv
 *
 */
public class ReportParam implements Serializable {
  private static final long serialVersionUID = 1578368573876415182L;

  public void validate() throws ThorServiceException {
    Assert.assertArgumentNotNull(getAggregationValueField(), "AggregationValueField");

    if (StringUtil.isNullOrBlank(getDimensionField()) == false
        && availableDimensionField.contains(getDimensionField()) == false)
      throw new ThorServiceException("不支持的报表类型：" + getDimensionField());
    if (availableAggregationValueField.contains(getAggregationValueField()) == false)
      throw new ThorServiceException("不支持的统计数据：" + getAggregationValueField());
  }

  protected static final Set<String> availableDimensionField = new HashSet<String>();
  protected static final Set<String> availableAggregationValueField = new HashSet<String>();

  // aggregation
  private String dimensionField;
  private String aggregationValueField;
  // where
  private Date date;
  private Date beginDate;
  private Date endDate;
  private String storeId;
  private List<String> storeIds = new ArrayList<String>();

  public String getDimensionField() {
    return dimensionField;
  }

  public void setDimensionField(String dimensionField) {
    this.dimensionField = dimensionField;
  }

  public String getAggregationValueField() {
    return aggregationValueField;
  }

  public void setAggregationValueField(String aggregationValueField) {
    this.aggregationValueField = aggregationValueField;
  }

  public Date getDate() {
    return date;
  }

  public void setDate(Date date) {
    this.date = date;
  }

  public String getStoreId() {
    return storeId;
  }

  public void setStoreId(String storeId) {
    this.storeId = storeId;
  }

  public Date getBeginDate() {
    return beginDate;
  }

  public void setBeginDate(Date beginDate) {
    this.beginDate = beginDate;
  }

  public Date getEndDate() {
    return endDate;
  }

  public void setEndDate(Date endDate) {
    this.endDate = endDate;
  }

  public List<String> getStoreIds() {
    return storeIds;
  }

  public void setStoreIds(List<String> storeIds) {
    this.storeIds = storeIds;
  }

}
